Skip to main content

Digital Banking Users Provider

This plugin is used by Insight Definitions Scheduler. It allows to select users to be used by triggered Scheduled Insights Definitions. Typically, these are all digital banking users.

Implementation

The plugin implementation should ensure that all users are provisioned in an iterative and batch fashion. To do this, implement the following IUserProvider interface from the Meniga.TriggeringEngine.Contracts.External assembly:

namespace Meniga.TriggeringEngine.Contracts.External.Users
{
/// <summary>Interface required to be implemented users providers.</summary>
public interface IUserProvider
{
/// <summary>
/// Returns an array of batches that contain information about users that should be fetched by a batch.
/// </summary>
/// <param name="batchSize">Size of a batch.</param>
/// <returns></returns>
Task<IEnumerable<IUserBatchMetadata>> GetBatches(int batchSize);

/// <summary>Returns users based on a provided batch</summary>
/// <param name="userIdFrom">The lower boundary of users to fetch</param>
/// <param name="userIdTo">The upper boundary of users to fetch</param>
/// <returns></returns>
Task<IEnumerable<IUser>> GetUsers(long userIdFrom, long userIdTo);

/// <summary>Returns users based on their ids.</summary>
/// <param name="userIds">User ids to fetch.</param>
/// <returns></returns>
Task<IEnumerable<IUser>> GetUsers(long[] userIds);
}
}

Registering dependencies

The plugin is used and registered with the Insight Definitions Scheduler. To register dependencies, implements the IInsightDefinitionsSchedulerPluginInstaller interface from Meniga.TriggeringEngine.Contracts.External assembly, for example:

using Meniga.InsightsFactory.DigitalBankingUsersProvider.UsersProvider;
using Meniga.TriggeringEngine.Contracts.External;
using Microsoft.Extensions.DependencyInjection;

namespace Meniga.InsightsFactory.DigitalBankingUsersProvider;

public class InsightDefinitionsSchedulerPluginInstaller : InsightDefinitionsSchedulerPluginInstaller
{
public string PluginName => "DigitalBankingPlugin";

public void Configure(IServiceCollection services)
{
services.AddScoped<IUserProvider, UserProvider>();
}
}